<?php
/**
 * Created by PhpStorm.
 * User: sunshine
 * Date: 2016/8/31
 * Time: 14:48
 */

require_once ('Admin/View/template/inc_admin.php');
?>

<div class="col-md-10  col-xs-12 col-sm-10 col-sm-offset-1 col-md-offset-1 col-xs-offset-1"  style="position: relative;top: 50px;"  >
    <h2 style="color: #03c2f9; margin-bottom: 0px;padding-bottom: 0px;"><p class="bg-white" style="margin-bottom: 10px;margin-top: 10px" >判断题列表</p></h2>
    <h4><p class="bg-info" style="margin-top:0px ;padding:10px" ><a href="admin.php" style="color: white">首页&nbsp;</a>/&nbsp;判断题列表</p></h4>
</div>

<div class="container-fluid control-label  col-md-12 ">
    <table class="table table-hover" style="width: 1250px;margin-top:150px;margin-left: 150px; color: #0a0a0a;font-size: 20px;font-family: 微软雅黑">
        <tr  class="danger">
            <th  style="padding-left: 50px;background-color: #eee;">题号</th>
            <th style="padding-left: 50px;background-color: #eee;">试卷名</th>
            <th style="padding-left: 50px;background-color: #eee;">内容</th>
            <th style="padding-left: 50px;background-color: #eee;">分值</th>
            <th style="padding-left: 50px;background-color: #eee;">答案</th>
            <th style="background-color: #eee;">操作</th>
        </tr>

        <?php
        foreach ($data['test'] as $row) {
            if(is_array($row)) {
                echo ' <tr class="success"  >';
                echo '<td style="padding-left: 60px">' . $row['j_id'] . '</td>';
                echo '<td style="padding-left: 60px">' . $row['pid'] . '</td>';
                echo '<td style="padding-left: 60px">' . $row['content'] . '</td>';
                echo '<td style="padding-left: 60px">' . $row['score'] . '</td>';
           
                echo '<td style="padding-left: 60px">' . $row['ans'] . '</td>';
                echo '<td><button class="btn btn-info" style="font-family: 微软雅黑;margin-top:10px; padding-left:11px; background-color:#90EE90;width:50px;height:30px"><a style="color:black;" href="admin.php?c=j_test&m=mod&id=' . $row['j_id'] . ' ">修改</a></button>
	 <button class="btn btn-danger" style="font-family: 微软雅黑;margin-top:10px;padding-left:11px; background-color:#E9967A;width:50px;height:30px"><a style="color:black;" href="admin.php?c=j_test&m=delete&id=' . $row['j_id'] . '" onClick="return confirm(\'确定要删除吗？\');">删除</a></button></td>';
                echo '</tr>';
            }
            else{
                $totalrows=1;
                echo ' <tr class="success"  >';
                echo '<td style="padding-left: 60px">' .$data['test']['j_id']. '</td>';
                echo '<td style="padding-left: 60px">' . $data['test']['pid'] . '</td>';
                echo '<td style="padding-left: 60px">' . $data['test']['content'] . '</td>';
               echo '<td style="padding-left: 60px">' . $data['test']['score'] . '</td>';
                echo '<td style="padding-left: 60px">' . $data['test']['ans'] . '</td>';
                echo '<td><button class="btn btn-info" style="font-family: 微软雅黑;margin-top:10px; padding-left:11px; background-color:#90EE90;width:50px;height:30px"><a style="color:black;" href="admin.php?c=j_test&m=mod&id=' . $data['test']['j_id'] . ' ">修改</a></button>
	 <button class="btn btn-danger" style="font-family: 微软雅黑;margin-top:10px;padding-left:11px; background-color:#E9967A;width:50px;height:30px"><a style="color:black;" href="admin.php?c=j_test&m=delete&id=' . $data['test']['j_id'] . '" onClick="return confirm(\'确定要删除吗？\');">删除</a></button></td>';
                echo '</tr>';
                break;

            }
        }
        echo '</table>';
        if($totalrows!=1)
        $totalrows = count($data['test']);
        echo '<h2 style="font-family:微软雅黑;text-align:right;color:red">共有'.$totalrows.'道判断题</h2>';
        ?>
</div>
</body>
</html>